home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.arizona.edu / ftp.cs.arizona.edu.tar / ftp.cs.arizona.edu / icon / newsgrp / group96a.txt / 000121_icon-group-sender _Wed May 29 23:07:51 1996.msg < prev    next >
Internet Message Format  |  1996-09-05  |  2KB

  1. Received: by cheltenham.cs.arizona.edu; Thu, 30 May 1996 08:14:20 MST
  2. Date: Wed, 29 May 1996 23:07:51 -0400 (EDT)
  3. From: "Phillip L. Thomas" <ptho@loc.gov>
  4. To: Stewart Midwinter <midtoad@cadvision.com>
  5. Cc: icon-group@cs.arizona.edu
  6. Subject: Re: 'Word wrap' utility
  7. In-Reply-To: <4ne7tk$17vo@elmo.cadvision.com>
  8. Message-Id: <Pine.A32.3.91.960529225759.52862E-100000@rs8.loc.gov>
  9. Mime-Version: 1.0
  10. Content-Type: TEXT/PLAIN; charset=US-ASCII
  11. Errors-To: icon-group-errors@cs.arizona.edu
  12. Status: O
  13.  
  14. On 16 May 1996, Stewart Midwinter wrote:
  15. ...
  16. > Often we receive mail messages, or FAQs, or other items that, when
  17. > printed through a word processor or other program in proportional font
  18. > instead of courier font, look terrible, since the lines are too short
  19. > and of uneven length.  The idea is to strip out all hard carriage
  20. > returns within paragraphs, so that the full line length is used. 
  21. > Looks much nicer, but manually is not the way!
  22. > The problem centers around how to tell what carriage returns to strip
  23. > out:
  24.  
  25. The easiest solution in icon (or any other decent text language
  26. like snobol4/spitbol) is to handle two lines at a time, beginning
  27. with the first line set to "" and then read new lines into the
  28. second line:
  29.     firstline := ""
  30.     while secondline := read() do {
  31.       # if secondline should not be appended to firstline
  32.       # then write the firstline and make firstline := ""
  33.       # if second line can be printed now, do it
  34.       # else firstline ||:= secondline
  35.       }
  36.     write(\firstline)
  37.  
  38. I'd write a procedure to determine the printability of the
  39. second line and use in it icon's excellent matching and
  40. addressing functions to code your conditions.
  41.  
  42. -- Phillip Lee Thomas
  43.    Library of Congress
  44.